#ifndef OPENGL_HPP
#define OPENGL_HPP

#include <QtOpenGL>
#include <QGLWidget>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QKeyEvent>
#include <GL/glut.h>
#include <vector>
#include "loader/loaderobj.hpp"
#include "loader/objetobj.hpp"
#include "loader/point3d.hpp"

class OpenGlWidget : public QGLWidget
{
    Q_OBJECT
public:
    explicit OpenGlWidget(QWidget *parent = 0);
public slots:
    void testSlots(QPoint);
signals:
    void close_app(bool);
    void sendAngleX(float angle);
protected:
    void initializeGL();
    void resizeGL(int width, int height);
    void paintGL();
    void keyPressEvent( QKeyEvent *keyEvent );
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void wheelEvent(QWheelEvent *event);

    //    Variables
public:
private:
    static const float angle_pas = 1.0;
    static const float zoom_pas = 2.0;

    int SIZEX, SIZEY;

    float angle_x;
    float angle_y;
    float angle_z;

    float zoom_cam;

    bool left_pressed;
    QPoint old_point;
    vector<objetOBJ> _objets;
};

#endif // OPENGL_HPP
